/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package midlet;

import domain.controller.rms.RecordStorePool;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import util.J2meAppHelper;
import view.InicialForm;

/**
 * @author Victorino
 */
public class Mearch extends MIDlet {

    private boolean midletPaused = false;
    private Ticker ticker;
    
    public Mearch() {

        
    }

    private void initialize() {
    }

    public void startMIDlet() {

        J2meAppHelper.getInstance().setMidlet(this);
        J2meAppHelper.getInstance().changeForm(InicialForm.getInicialForm());

    }

    public void resumeMIDlet() {
    }

    public void switchDisplayable(Alert alert, Displayable nextDisplayable) {

        Display display = getDisplay();

        if (alert == null) {
            display.setCurrent(nextDisplayable);
        } else {
            display.setCurrent(alert, nextDisplayable);
        }
    }

    public Ticker getTicker() {
        if (ticker == null) {
            ticker = new Ticker("Seu sistema de busca m\u00F3vel");//GEN-LINE:|52-getter|1|52-postInit
        }//GEN-LINE:|53-getter|3|
        return ticker;
    }

    public Display getDisplay() {
        return Display.getDisplay(this);
    }

    public void exitMIDlet() {
        RecordStorePool.getInstance().closeAllRecordStore();
        switchDisplayable(null, null);
        destroyApp(true);
        notifyDestroyed();
    }

    public void startApp() {
        if (midletPaused) {
            resumeMIDlet();
        } else {
            initialize();
            startMIDlet();
        }
        midletPaused = false;
    }

    public void pauseApp() {
        midletPaused = true;
    }

    public void destroyApp(boolean unconditional) {
    }
}
